import request from '@/utils/request'
import utils from "../../views/js/index";

// 查询退款信息
export function queryrefund(query) {
    return request({
        url: '/yzxmp/orderservice/queryrefund',
        method: 'get',
        params: query
    })
}
// 查询分销商
export function querytrader(query) {
    return request({
        url: '/yzxmp/customerservice/querytrader',
        method: 'get',
        params: query
    })
}

// 查询客运站列表
export function querystations(query) {
    return request({
        url: '/yzxmp/orderservice/querystations',
        method: 'get',
        params: query
    })
}
// 查询目的站点列表
export function querytargets(query) {
    return request({
        url: '/yzxmp/orderservice/querytargets',
        method: 'get',
        params: query
    })
}
// 导出查询列表
export function downloadrefund(query) {
    request({
        url: '/yzxmp/orderservice/downloadrefund',
        method: 'get',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        params: query,
        responseType: 'blob'
    }).then(res => {
        const content = res;
        const blob = new Blob([content]);
        if ("download" in document.createElement("a")) {
            const elink = document.createElement("a");
            elink.download = `订单-${utils.utils.NewDate()}下载.xlsx`;
            elink.style.display = "none";
            elink.href = URL.createObjectURL(blob);
            document.body.appendChild(elink);
            elink.click();
            URL.revokeObjectURL(elink.href);
            document.body.removeChild(elink);
        } else {
            navigator.msSaveBlob(blob, 'filename');
        }
    })
}


